﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QLNS_Public;
using System.Data;

namespace QLNS_Data
{
  public  class KyLuat_Data
    {
      KetNoiCSDL_Data kn = new KetNoiCSDL_Data();

      public DataTable LayDuLieu()
      {
          return kn.LayDuLieu("Load_tbl_KyLuat");
      }
      public DataTable taoBang(string sql)
      {
          return kn.taobang(sql);
      }
      public int update_KyLuat(KyLuat_Public maKyLuat, KyLuat_Public maNhanVien, KyLuat_Public ngayKyLuat, KyLuat_Public nguyenNhan)
      {
          int n = 4;
          string[] name = new string[n];
          object[] value = new object[n];
          name[0]="@MaKyLuat";
          value[0] = maKyLuat.MaKyLuat;
          name[1] = "@MaNhanVien";
          value[1] = maNhanVien.MaNhanVien;
          name[2] = "@NgayKyLuat";
          value[2] = ngayKyLuat.NgayKyLuat;
          name[3] = "@NguyenNhan";
          value[3] = nguyenNhan.NguyenNhan;
          return kn.update("Update_KyLuat",name,value,n);
      }
      public int insert_KyLuat(KyLuat_Public maNhanVien, KyLuat_Public ngayKyLuat, KyLuat_Public nguyenNhan)
      {
          int n = 3;
          string[] name = new string[n];
          object[] value = new object[n];
          name[0] = "@MaNhanVien";
          value[0] = maNhanVien.MaNhanVien;
          name[1] = "@NgayKyLuat";
          value[1] = ngayKyLuat.NgayKyLuat;
          name[2] = "@NguyenNhan";
          value[2] = nguyenNhan.NguyenNhan;
          return kn.update("Insert_KyLuat", name, value, n);
      }
      public int delete_KyLuat(KyLuat_Public maKyLuat)
      {
          int n = 1;
          string[] name = new string[n];
          object[] value = new object[n];
          name[0] = "@MaKyLuat";
          value[0] = maKyLuat.MaKyLuat;
          return kn.update("Delete_KyLuat", name, value, n);
      }
    }
}
